package com.srd.phone.activity;

import android.content.Intent;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.animation.Animation;
import android.widget.ImageView;

import com.shengrongdai.srd.R;
import com.srd.phone.mvp.interfaces.LaunchView;
import com.srd.phone.mvp.presenters.LaunchPresenter;
import com.srd.phone.utils.Constants;
import com.srd.phone.utils.PreferenceUtils;

public class LaunchActivity extends BaseLaunchActivity implements LaunchView{

    private ImageView iv_bg;
    private LaunchPresenter presenter;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_launch);

        initView();
        initData();
    }

    public void initView() {
        iv_bg = (ImageView)findViewById(R.id.iv_bg);
    }

    public void initData() {
        presenter = new LaunchPresenter(this, this);
        presenter.initialized();
    }


    @Override
    public void animateBackgroundImage(Animation animation) {
        iv_bg.startAnimation(animation);
    }

    @Override
    public void gotoHome() {

        if(!TextUtils.isEmpty(PreferenceUtils.getInstance().getData(Constants.GESTURE_LOCK_KEY, ""))){
            Intent intent = new Intent(this, GestureUnLockActivity.class);
            intent.putExtra("titleName", "");
            readyGoThenKill(intent);
        }else{
            readyGoThenKill(MainActivity.class);
        }

    }
}
